CS424 Assignment 3

Due 15 February 2007.

  1. Using Linda operations in and out implement a counting semaphore such that i) there is at most one tuple in tuplespace, ii) there is no polling (repeatedly assessing the state of the semaphore to decide if a process may continue).
  2. Modify the simple master/worker example to associate f(x) with the correct x when multiple workers are used.
  3. Add a clean shutdown for the workers.
  4. Grad: Implement a sort of syntactic sugar for NWS variables. Using your mechanism, a user executes, say, ssx = ... . ssx can then be used to fetch and store values for a variable 'x' in workspace ws thus:
    >>> ssx(range(15))
    >>> ssx('cat')
    >>> ssx(3.14)
    >>> ssx()
    [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]
    >>> ssx()
    'cat'
    >>> ssx()
    3.1400000000000001
    
    ws and 'x' will presumably appear in ... . The python code ... may refer to some other code (i.e., you are not constrained to implement this with one single expression).